﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/view.Master" Inherits="System.Web.Mvc.ViewPage<dynamic>" %>

<%@ Import Namespace="Workflow.Model.Enum" %>
<%@ Import Namespace="Workflow.Resource" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <script type="text/javascript">


           $(function () {
                  <%
                    //PL load close data
                    int rolecode = (int)ViewData["RoleCode"];
                    if (rolecode == (int)EnumRole.GPEEMPL 
                    || rolecode == (int)EnumRole.GPPTPPL 
                    || rolecode == (int)EnumRole.GPAHPTPPL 
                    || rolecode == (int)EnumRole.GPAHEEMPL
                    )
                    {
                %>
                      $('#WorkStatus').combobox('setValue','<%=(int)EnumWorkStatus.Closed %>');
                    

                <%
                     }
                %>

               var queryParams = $('#tt').datagrid('options').queryParams;

               queryParams.WorkStatus = $('#WorkStatus').combobox('getValue');
               $('#tt').datagrid({
                   title: '<%=Global.MyTaskGPEEM %>',
                   width: 700,
                   height: 600,
                   fit: true,
                   remoteSort: true,
                   singleSelect: false,
                   idField: 'CaseNo',
                   url: '/GPEEM/GetMyTaskData',
                   fitColumns: true,
                   striped: true,
                   pageSize: 20,
                   pageList: [5, 10, 15, 20],
                   columns: [[
					{ field: 'CaseNo', title: '<%=Global.CaseNo %>', sortable: 'true', width: 60 },
                      { field: 'BatchNo', title: '<%=Global.BatchNo %>', sortable: 'true', width: 40 },
					{ field: 'InvoiceNo', title: '<%=Global.InvoiceNoEEM %>', sortable: 'true', width: 95 },

					//{ field: 'FileName', title: '<%=Global.FileName %>', sortable: 'true', width: 100 },
                     { field: 'action', title: '<%=Global.FileName %>', width: 100, align: 'center',
                        formatter: function (value, row, index) {

                            var s = '<a href="#" class="tooltips" style="text-decoration:none;color:blue" onclick="tiffedit(' + row.CaseNo + ',' + row.WorkStatusCode + ')" >' + row.FileName + ' </a> ';

                            return s;

                        }
                    },
			     	{ field: 'FolderLevelA', combobox: true, title: '<%=Global.FolderLevelA %>', width: 60, sortable: 'true', align: 'right' },
                    { field: 'FolderLevelB', combobox: true, title: '<%=Global.FolderLevelB %>', width: 80, sortable: 'true', align: 'right' },
                  	{ field: 'CheckType', combobox: true, title: '<%=Global.CheckType %>', width: 80, sortable: 'true', align: 'right' },
                    { field: 'WorkStatus', title: '<%=Global.WorkStatus %>', width: 50, sortable: 'true', align: 'center' },
                    { field: 'StatusDate', title: '<%=Global.StatusDate %>', width: 90, sortable: 'true', align: 'center' },
                    { field: 'StatusOperator', title: '<%=Global.StatusOperatorEEM %>', width: 60, sortable: 'true', align: 'center' },
                    { field: 'StatusComment', title: '<%=Global.StatusComment %>', width: 95, sortable: 'false', align: 'center',
                        formatter: function (value, row, index) {

                            var s = '<a href="#" class="tooltips" style="text-decoration:none;color:black" title="' + value + '"   onclick="tooltips(\'' + value + '\') ;unselect(' + index + ');return false;">' + value + '</a> ';
                            return s;

                        }
                    }
//                    { field: 'action', title: '<%=Global.Action %>', width: 70, align: 'center',
//                        formatter: function (value, row, index) {

//                            var s = '<a  onclick="tiffedit(' + row.CaseNo + ')" >' + row.FileName + ' </a> ';

//                            return s;

//                        }
//                    }

				]],
                   sortName: 'CaseNo',
                   sortOrder: 'asc'
               });
           });

           var s = false;
           function tooltips(value) {
              
               s = true;
            
               $.messager.alert('Comment', value);
              

           }
           function unselect(index) {
               $('#tt').datagrid('unselectRow', index);

           }
           function tiffedit(id, workStatus) {
               window.open("/tiff/indexEEM?caseNo=" + id + "&NextCaseKeepStatus=" + workStatus, "_blank", "fullscreen");

           }

           function Search() {
               var queryParams = $('#tt').datagrid('options').queryParams;

               queryParams.WorkStatus = $('#WorkStatus').combobox('getValue');
               queryParams.InvoiceNo = $('#InvoiceNo').val();
               queryParams.ReceiveDateFrom = $('#ReceiveDateFrom').datebox('getValue');
               queryParams.ReceiveDateTo = $('#ReceiveDateTo').datebox('getValue');
                queryParams.FileName = $('#FileName').val();


               $('#tt').datagrid('options').queryParams = queryParams;
               $("#tt").datagrid('reload');
           }
          
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form class="easyui-layout" method="post" id="form" name="form" style="width: 100%;
    height: 700px;">
    <div region="center">
        <table id="tt" class="easyui-datagrid" style="width: 600px; height: 250px" idfield="itemid"
            iconcls="icon-save" rownumbers="true" toolbar="#tb" pagination="true">
            <div id="tb" style="padding: 5px; height: auto">
                <div style="margin-bottom: 5px">
                    <a href="#" class="easyui-linkbutton" iconcls="icon-search" onclick="Search();">
                        <%=Global.Search%></a>
                </div>
                <div>
                    <%=Global.dateFrom %>:
                    <input id="ReceiveDateFrom" class="easyui-datebox" style="width: 80px">
                    <%=Global.dateTo %>:
                    <input id="ReceiveDateTo" class="easyui-datebox" style="width: 80px">
                    <%=Global.InvoiceNoEEM%>.:<input id="InvoiceNo" class="txt01" style="width: 100px">
                     <%
                	var level = "";
                    //PL load close data
                    int rolecode = (int)ViewData["RoleCode"];
                    if (rolecode == (int)EnumRole.GPEEMPL 
                        || rolecode == (int)EnumRole.GPPTPPL
                        || rolecode == (int)EnumRole.GPAHPTPPL
                        || rolecode == (int)EnumRole.GPAHEEMPL)
                    {
                    %>
                       <%=Global.WorkStatus%>:<input id="WorkStatus" class="easyui-combobox" style="width: 100px"
                        url="/GPEEM/GetWorkStutes?level=PL" valuefield="WorkStatusCode" textfield="WorkStatusNameEEM"
                        editable="false">
                         <%=Global.FileName%>:<input id="FileName" class="easyui-validatebox" style="width: 120px">
                
                    <%
}
                    else
                    {
%>
<%=Global.WorkStatus%>:<input id="WorkStatus" class="easyui-combobox" style="width: 100px"
                        url="/GPEEM/GetWorkStutes?level=PA" valuefield="WorkStatusCode" textfield="WorkStatusNameEEM"
                        editable="false">
<%
                    }%>                 
                </div>
            </div>
        </table>
    </div>
    </form>
</asp:Content>
